<template>
  <el-table :data="list">
    <el-table-column label="备件" prop="part.name" />
    <el-table-column label="制造商参考编号" prop="provider.name" />
    <el-table-column label="注意" prop="noteic" />
    <el-table-column label="数量" prop="number" />
    <el-table-column label="库存" prop="part.number" />
    <el-table-column label="库位">
      <template v-slot="{row}">
        {{ pcatStorage[row.part.storage_location] }}
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import API from '@/api/asset/equipment/material'
import {
  pcatStorage
} from '@/utils/options'
export default {
  name: 'EquipmentPart',
  props: {
    value: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      query: {},
      list: [],
      pcatStorage
    }
  },
  watch: {
    value() {
      this.index()
    }
  },
  created() {
    this.index()
  },
  methods: {
    index() {
      API.index({ equipment_id: this.value }).then(response => {
        console.log('TCL: index -> response', response)
        this.list = response.data.data
      })
    }
  }
}
</script>

<style>
</style>
